<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	>
<h:head>
	<title>login</title>
	<link rel="stylesheet" type="text/css"
		href="../themes/#{themeBean.theme}/skin.css" />
	<link rel="stylesheet" type="text/css"
		href="../resources/css/controlling/login_index.css" />
</h:head>
<h:body>

	<h:form>
	#{userBean.checkbpreviousLogin()}
		<div style="padding: 15% 0px  0px 35% ;">
			<p:panel header="User Information"
				style="font-size: 12px;font-style: italic;width: 450px;height:250px;">

				<h:panelGrid columns="2">
					<h:outputText value="User Name" />
					<p:inputText required="true"
						requiredMessage="User Name is required" id="name" size="20"
						value="#{userBean.userName}" />

					<h:outputText value="Password" />
					<p:password id="pass" requiredMessage="Password is required"
						value="#{userBean.password}" required="true" size="20" feedback="false"
						/>

				</h:panelGrid>
				<br />
				<h:panelGrid columns="2">
					<p:selectBooleanCheckbox value="#{userBean.rememberMe}" />
					<h:outputText value="Remeber me on this computer" />
				</h:panelGrid>
				<p:commandLink onclick="forgetPassDlg.show();" value="Forget Password" />
				<br />
				<br />
				<p:commandButton  value="login" update="loginMsg"
					action="#{userBean.loginUser}" onclick="dialog.show();" oncomplete="dialog.hide();"/>
				<p:spacer height="20" width="20" />
				<p:messages id="loginMsg"/>
			</p:panel>

			<p:dialog header="waiting" modal="true" widgetVar="dialog"
				closable="false" draggable="false" resizable="false"
				style="font-size: 15px;font-family: times ">
				<h:graphicImage value="../resources/images/ajaxLoadingBar.gif" />
			</p:dialog>
			
			<p:dialog header="Forget Password" modal="true" widgetVar="forgetPassDlg"
				closable="true" draggable="false" resizable="false"
				style="font-size: 15px;font-family: times ">
				<p:inputText value="#{userBean.email}"/>
				<p:commandButton value="Send Email" ajax="true" update="loginMsg"
					action="#{userBean.forgetPassword}" onstart="dialog.show();" oncomplete="dialog.hide(); forgetPassDlg.hide();" />
				
			</p:dialog>
		</div>
	</h:form>
</h:body>
</html>

